<%-- 
    Document   : enviarmailpedido
    Created on : 20-ene-2012, 10:03:10
    Author     : Fran & Jon
--%>

<%@page import="com.ipartek.formacion.gestformwww.controlador.Verificador"%>
<%@page import="com.ipartek.formacion.gestformwww.modelo.beans.Material"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@include file="validarusuario.jsp" %>
<div class="contenido">
    <h2 align="center">Realizar pedido</h2>
    <form action="enviar-mail-pedido-accion.do" name="mailpedido" method="POST">
        <input type="hidden" name="aleatorioEnviarEmail" value="<%=Math.random()%>" />
        <input type="hidden" name="idCurso" value="<%=request.getParameter("idCurso")%>"/>
        <input type="hidden" name="listamaterial" value="<%=request.getAttribute("listamaterial")%>"/>
        <div id="submenu">
            <%@include file="menumailpedido.jsp"%>
        </div><br>
        <%
        ArrayList<Material> materiales = (ArrayList<Material>) request.getAttribute("listamaterial");
        String[] ids = request.getParameterValues("listaIdEntregaPedir");
        
        for (String id : ids) {%>
            <input type="hidden" name="listaIdEntregaPedir" value="<%=id%>"/>
        <%}%>
        
        
        <jsp:include page="excepciones.jsp" flush="true" />
        <jsp:include page="errores.jsp" flush="true" />
        <br><br>
                <table>
                
                <select name="asuntoplantilla" style="display: none">
                       <option></option> 
                <option value="Pedido de Material"/></option>
                </select>

                <table width="100%">
                <thead>
                <tr>
                    <th width="50%"><center>ISBN</center></th>
                    <th width="50%"><center>Titulo</center></th>
                    <th width="50%"><center>Editorial</center></th>
                    <th width="50%"><center>Cantidad</center></th>
                </tr>
                </thead>
                </table>
                 <%for (Material material : materiales) {%>
                    <input type="hidden" name="idLibro" value="<%=material.getLibId()%>"/>
                    <input type="hidden" name="cantLibro" value="<%=material.getCantidadPedido()%>"/>
                     <table width="100%">
                    <tr>
                        <td width="50%" colspan="1">
                            <label for="<%=material.getLibId()%>" ><%=material.getIsbn()%></label>
                        </td>
                        <td width="50%" colspan="1">
                            <label for="<%=material.getLibId()%>" ><%=material.getLibTitulo()%></label>
                        </td>
                        <td width="50%" colspan="1">
                            <center>
                            <label for="<%=material.getLibId()%>" ><%=material.getLibEditorial()%></label>
                            </center>
                         </td>
                         <td width="50%" colspan="1">
                             <center>
                            <label for="<%=material.getLibId()%>" ><%=material.getCantidadPedido()%></label>
                            </center>
                         </td>
                    </tr>
                    <%}%>

                    <tr>
                    </table>
                </table><br>
                <table>
                    <tr>
                    <td width="100%">Asunto:&nbsp; <input type="text" name="asunto" value="" size="68%"/>
                </tr>
                <tr>
                    <td  width="100%">Texto:&nbsp;</td>
                </tr>
    </table>
    <table width="100%">
                <tr>
                    <td><textarea name="textoemail" cols="200" rows="15" style="width:85%"  onkeyup="if (!validarCaracteres(this.value, true)) this.value=cadenaCorrecta(this.value);"><%if (request.getParameter("textoemail") != null) {%><%= request.getParameter("textoemail")%><%}%></textarea></td>
                </tr>
    </table>
            <br>
    </form>
</div>

